package model;

import java.util.Queue;

import sharedGameLogic.enums.BattleEvent;
import sharedGameLogic.players.Player;

import network.ModelListener;
import network.NetworkID;


/**
 * The IServerModel defines the model that describes the game this server is a host for.
 * 
 * @author Tobias
 *
 */
public interface IServerModel {
	
	/**
	 * Updates the game model with instructions from a player. If both players have been updated
	 * one round of the game is run.
	 * 
	 * @param playerID - The ID of the player whom the instructions came from.
	 * @param actions - The moves the player wishes to perform.
	 */
	public void update(NetworkID playerID, Queue<BattleEvent> actions);
	
	/**
	 * Initiates the game model by setting the Player objects.
	 * 
	 * @param player - One of the two players in the game
	 * @param id - That players "ID"
	 */
	public void init(Player player, NetworkID id);
	
	/**
	 * Checks if (at least) one of the characters health is zero or less.
	 * 
	 * @return - true, if at least one of the characters health is 0 or less than zero.
	 * 			Otherwise, false.
	 */
	public boolean isGameOver();
	
	/**
	 * Checks if the model has received all necessary data in order for the game to start.
	 * 
	 * @return - true if the game is ready to start. Otherwise false.
	 */
	public boolean isGameReady();
	
	/**
	 * Adds a ModelListener to this IServerModel
	 * 
	 * @param listener - The ModelListener to add.
	 */
	public void addModelListener(ModelListener listener);

	/**
	 * Removes a ModelListener from this IServerModel.
	 * 
	 * @param listener - The ModelListener to remove.
	 * @return - true, if the ModelListener actually was a listener to this IServerModel
	 * 			and now is removed. Otherwise, false.
	 */
	public boolean removeModelListener(ModelListener listener);
}

